﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Basics
{
    public class Person
    {
        #region properties
        private string _FirstName;
        private string _LastName;
        private int _Age;

        public int Age
        {
            get;
            set;
        }

        public string FirstName
        {
            get { return this._FirstName; }
            set
            {
                if (value.Length > 50)
                {
                    Console.WriteLine("Error! FirstName must be less then 51 characters!");
                }
                else
                {
                    this._FirstName = value;
                }
            }
        }

        public string LastName
        {
            get { return this._LastName; }
            set
            {
                if (value.Length > 50)
                {
                    Console.WriteLine("Error! LastName must be less then 51 characters!");
                }
                else
                {
                    this._LastName = value;
                }
            }
        }
        #endregion

        #region constructors
        public Person() { }
        public Person(string firstname, string lastname, int age = 21)
        {
            FirstName = firstname;
            LastName = lastname;
            Age = age;
        }
        #endregion

        #region methods
        public string Eat(string food)
        {
            return "eat " + food;
        }

        public virtual string ShowDetails()
        {
            return "Person: " + FirstName + " " + LastName + " / Age: " + Age;
        }
        #endregion
    }

    public class Employee : Person
    {
        #region properties
        private string _Department;

        public string Department
        {
            get { return this._Department; }
            set
            {
                if (value.Length > 100)
                {
                    Console.WriteLine("Error! Department must be less then 100 characters!");
                }
                else
                {
                    this._Department = value;
                }
            }

        }
        #endregion

        #region constructors
        public Employee() { }
        public Employee(string firstname, string lastname, string department)
        {
            FirstName = firstname;
            LastName = lastname;
            Department = department;
        }
        #endregion

        #region methods

        public string TypeCode()
        {
            return "type code in c#";
        }

        /*
        public override string ShowDetails()
        {
            return "Employee: " + FirstName + " " + LastName + " (" + Department + ")";
        }
        */
        #endregion
    }
}
